const router = require("koa-router")({
    prefix: "/user"
})

router.post("/login", ctx => {
    const { name } = ctx.request.body
    ctx.body = name === "darcrand" ? { code: 1000, msg: "login success" } : { code: 1001, msg: "login fail" }
})

router.get("/info", ctx => {
    const { id } = ctx.query
    ctx.body = {
        code: 1000,
        data: { id, name: "Darcrand", age: 20 }
    }
})

module.exports = router
